<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户主页</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <!-- layui的水平导航 -->
    <div class="layui-header">
        <div class="layui-logo"><strong>高校健康上报系统</strong></div>
    </div>

    <!-- layui的垂直导航 -->
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item ">
                    <a href="/zhuye"><i class="layui-icon layui-icon-home"></i>  用户主页</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/userinfo"><i class="layui-icon layui-icon-survey"></i>  个人信息上报</a>
                </li>
                <li class="layui-nav-item layui-this">
                    <a href="/record"><i class="layui-icon layui-icon-log"></i>  上报记录</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/china"><i class="layui-icon layui-icon-list"></i>  国内省份数据</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/global1"><i class="layui-icon layui-icon-list"></i>  全球国家数据</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/regional"><i class="layui-icon layui-icon-list"></i>  全球地区数据</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/logout"><i class="layui-icon layui-icon-logout"></i>  退出系统</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div style="padding: 15px;">
            <div class="demoTable">
                查询条件:
                <div class="layui-inline">
                    <input class="layui-input" type="date" name="id" id="time" placeholder="请输入查询时间" autocomplete="off">
                </div>
                <div class="layui-inline">
                    <input class="layui-input" name="id" id="streettown" placeholder="请输入查询地址" autocomplete="off">
                </div>
                <div class="layui-inline">
                    <input class="layui-input" name="id" id="temperature" placeholder="请输入查询温度" autocomplete="off">
                </div>
                <button class="layui-btn" id="selectByCondition" data-type="reload">查询</button>
            </div>
            <table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>

        </div>
    </div>
    <script src="../layui/layui.js"></script>
    <script>
        layui.use('element', function(){
            var element = layui.element;

        });

        layui.use('table', function(){
            var table = layui.table;
            table.render({
                elem: '#LAY_table_user'
                ,url:'/reportrecord'
                ,cellMinWidth: 80
                ,toolbar:true
                ,title:'用户数据表'
                ,totalRow:true
                ,cols: [
                    [
                        {field:'time', title: '日期', sort: true}
                        ,{field:'streettown', title: '所在街镇'}
                        ,{field:'temperature', title: '温度', sort: true}
                        ,{field:'health', title: '身体状况'}
                    ]
                ]
                ,id: 'testReload'
            });
            var $ = layui.$, active = {
                reload: function(){
                    var temperature = $('#temperature');
                    var time = $('#time');
                    var streettown = $('#streettown');
                    console.log("key:" + temperature.val());
                    table.reload('testReload', {
                            url: '/selectUserInfoByCondition'
                            ,where: {
                                streettown:streettown.val(),
                                temperature:temperature.val(),
                                time:time.val(),
                            }
                        }
                    );
                }
            };
            $('.demoTable .layui-btn').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    </script>
</div>
</body>
</html>